/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.rational.sheet.table.cell.model;

import java.util.Comparator;

/**
 *
 * @author Overmind
 */
public class CellAddressComparator
    implements Comparator<CellAddress>
{
    public CellAddressComparator()
    {
        
    }
    
    @Override
    public int compare(CellAddress left, CellAddress right)
    {
        int compareRow = Integer.signum(left.getRow()- right.getRow());
        
        if(compareRow == 0)
        {
            int compareColumn = Integer.signum(left.getColumn() - right.getColumn());
            return compareColumn;
        }
        else
        {
            return compareRow;
        }
    }
    
}
